Identifiers

Before we show a completed example, let’s define the SYSTEM and PUBLIC keywords, or identifiers, and what they mean.

SYSTEM

A system identifier is a Universal Resource Identifier (URI) that is used to retrieve an external entity (physical storage object).  A URI is similar to a URL, except that URL’s are intended for network (Internet) use.  For all intents and purposes, the two terms are interchangeable.

A identifier can reference an absolute position or a relative position as is exemplified in the following code fragments:

<!-- Absolute reference -->
<!DOCTYPE doc.name SYSTEM  
”http://www.server.com/external.dtd”>

<!-- Relative reference -->
<!DOCTYPE doc.name SYSTEM “../DTDs/external.dtd”>

Most of the time you will use SYSTEM identifiers for your external DTD’s.

PUBLIC

A public identifier is the officially recorded identifier for an external entity.  Officially registered public identifiers are registered by the creator of the DTD with The International Standards Organization (ISO).  Public identifier names are assigned by the American Graphic Communication Association (CGA) under the direction of the ISO.

The syntax for a  public identifier name is:

reg.type // owner // description // language

Let’s break down all four elements of a public identifier name.

reg.type is a plus sign (+) sign if the owner is registered according to the ISO 9070 standard.  It is a minus sign (-) if it is not.  Most are not, so the minus sign (-) is more common.

owner is the creator of the identifier (individual or company).

description is a text description of the identifier.  Keep this short even though you can have a lot of text here.

language is the two character language code.

An example of a public identifier could be:

-//David Harding/My First Public Identifier//EN

When an XML processor encounters a PUBLIC identifier, it attempts to generate a location URI.  If it can’t locate the file, it uses a secondary parameter called a system literal, which you have to provide.  The following is an example of that.

<!ENTITY my.entities PUBLIC 
	“-//David Harding//My First Public Identifier//EN”,	“http://www.davidharding.com/public_id.xml”>

In this example, if the public identifier cannot be located using the public identifier name, the URI is used.

Tip:	Public identifier resolution has not been completely solved yet.  The method that is currently the defacto standard is the same as that of SGML, which uses and external catalog file called “catalog” that points to the various locations for each possible public identifier.  

Since this is not the official standard, and is likely to change, we are going to focus on system identifiers since that is what you are going to use most of (or all of) the time anyway.